<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	
	protected function _initViewHelpers()
	{
		Zend_Registry::set('Zend_Translate', 'CN');
		$this->bootstrap('layout');
		$this->bootstrap('view');
	
		$layout = $this->getResource('layout');
		$view = $layout->getView();	
		
			//pour utiliser les view helper dans le layout :
			$view->setHelperPath(APPLICATION_PATH . '/views/helpers');
			$view->doctype('XHTML1_TRANSITIONAL');  //Transitional XHTML1_STRICT
			//pour les navigateurs qui respectent les standards :
			$view->headLink(Array('rel' => 'icon', 'href' => '/favicon.ico', 'type' => 'image/vnd.microsoft.icon'));
			//pour IE :
			$view->headLink(Array('rel' => 'SHORTCUT ICON', 'href' => '/favicon.ico'));
			$view->headScript()->appendFile('/js/jquery.js', 'text/javascript');
			$view->headScript()->appendFile('/js/jquery.bpopup-0.7.0.min.js', 'text/javascript');
			$view->headTitle()->setSeparator(' - ');
			$view->headTitle(htmlentities('winning eleven - report system',ENT_QUOTES,'utf-8'))->setAutoEscape(false);
			$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
		
	}

	//permet de charger toute classe dans le répertoire 'application'
	protected function _initAutoload()
	{
		$moduleLoader = new Zend_Application_Module_Autoloader(array(
				'namespace' => '',
				'basePath' => APPLICATION_PATH,
		));
		return $moduleLoader;
	}
	
	protected function _initSessions()
	{
	
		//on s'assure que la connection à la base soit bien initialisée :
		$this->bootstrap('Db');
	
		$config = array(
				'name'           => 'g1_session',
				'primary'        => 'id',
				'modifiedColumn' => 'modified',
				'dataColumn'     => 'data',
				'lifetimeColumn' => 'lifetime'
		);
		//On définit les sessions comme étant stockées en base :
		Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
	
	}

}

